home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Technotools
/
Technotools (Chestnut CD-ROM)(1993).ISO
/
lang_pas
/
lister57
/
lister.doc
< prev
next >
Wrap
Text File
|
1989-11-11
|
6KB
|
133 lines
The Lister program was written in Turbo Pascal to print out
pascal programs. It has grown into a rather large and complex
program doing many more things than I had originally invisioned.
Among the variety of things which this program does is the orig
inal which is to print out a pascal program in a condensed for
mat. This means that up to 75 lines per page are put on the
paper. A page feed can be forced by the .PA command which word
star uses. Remember however that in pascal source code these
must be commented out( "{.PA}" for example ).
Part of the appeal of the Turbo Pascal package is that the
modules can remain small, and still produce a very large program.
It is this ability to "Include" files into larger programs which
required the listing program to do the same thing. To help the
programmer, the listing program separates the modules using a
dual line number scheme which numbers the entire program
continuously and also numbers each included module. You can
always find out what line a change is needed because the line
number within the module is listed correctly.
Anothe≥ probleφ fo≥ pasca∞ programmer≤ i≤ thσ locatioε oµ ì
thσá call≤á t∩á procedure≤ anΣ function≤ á whicΦá cros≤á pagσ ì
boundrie≤ oµ thσ listing«á Wσ jus⌠ can'⌠ seeφ t∩ finΣ thσ referì
enceΣá modulσá oµ code«á T∩ hel≡ this¼á thσá listinτá prograφ ì
insert≤á int∩ thσ listing¼á thσ cross-referencσ pagσá numbe≥ ì
wherσá thσ referenceΣ procedurσ o≥ functioε caε bσá located« ì
Iεá addition¼á thσ las⌠ pagσ oµ thσ listinτ i≤ ß cros≤ inde°á oµ ì
eacΦá á functioε o≥ procedurσ ¼á wherσ i⌠ caε bσ founΣá anΣ ì
eacΦ linσ numbe≥ iε thσ maiε prograφ wherσ thσ procedurσ o≥á ì
functioε i≤ calledíá Thi≤ i≤ donσ activel∙ a⌠ lis⌠ timσ s∩ ì
tha⌠á an∙ prograφ changes(re-arrangements⌐ arσ correctl∙ referì
enced.
.paè To complete the first stage of the program, a very friendly
menu was developed to interact with the user.
To use this program Type "LISTER56 program.ext" or
"LISTER56"
When the program name is included, the command line is used
to fill in the information into the program to be listed variable
and the menu asks whether you want to Edit, Print, Directory, or
Quit.
If the program name is not included, the same menu appears,
however you are defaulted into the edit option to enter the
required file to list.
Answer most questions with a "Y" or "N" key press and the
cursor will advance to the next question. Numbers require that a
number be entered. An Up or Down arrow key will move the cursor
in the proper direction. The return key will accept the default
answer just as a down arrow does. With this system, the user can
wander up and down the input screen changing anything he wants,
during the editing phase.
During the printing process, the printing can be suspended
at anytime by pressing any key on the keyboard. The printing can
be continued or aborted from that location with another keypress
as directed by the screen. This can be most useful when
answering the telephone.
.paè Thσá prograφá wa≤ enhanceΣ b∙ addinτ aεá automatiπá indexinτ ì
featurσá whicΦ wil∞ cros≤ referencσ eacΦ anΣ ever∙ variablσá useΣ ì
iεá thσá program«á Thσá lis⌠ i≤á accumulateΣá alphabeticall∙á b∙ ì
variablσá namσ theε b∙ loca∞ procedurσ namσ anΣ finall∙ globally« ì
Thi≤á featurσ i≤ defaulteΣ off¼á anΣ mus⌠ bσ turneΣ oε b∙ ßá men⌡ ì
selection« Thi≤ speed≤ u≡ thσ printou⌠ proces≤ anΣ doesn'⌠ wastσ ì
all of that paper until the final version is to be printed.
The structure of the program is shown in the following example
32 |+-- begin
33 || assign (F1,filespec);
34 || reset (F1);
35 || count := 1;
36 || diskspace := 0.0;
37 || str(count,str2);
38 || assign (F2,'a:Output'+str2+'.dat');
39 || rewrite (F2);
40 ||+-- repeat
41 ||| if diskspace > 300000.0 then
42 |||+-- begin
43 |||| close (F2);
44 |||| write (^G,' please insert another blank formatted diskette and press "RETURN" ');
45 ||||+-- repeat
46 ||||| ch := ^@;
47 ||||| if keypressed then
48 ||||| read (kbd,ch);
49 ||||+-- until ch = ^M;
50 |||| count := count + 1;
51 |||| str(count,str2);
52 |||| assign (F2,'a:Output'+str2+'.dat');
53 |||| rewrite (F2);
54 |||| diskspace := 0.0;
55 |||| writeln;
56 |||| writeln (' ...Continuing ');
57 |||+-- end;
58 ||| readln (F1,line);
59 ||| writeln (F2,line);
60 ||| diskspace := diskspace + length(line) + 1;
61 ||+-- until eof(F1);
A≤á yo⌡ caε seσ thi≤ make≤ thσ locatinτ thσ Begin-enΣá pair≤ ì
very simple
In version 3.5, marking of the reserved words was added due to
programmers requesting it. You see, I even listen to user comments.
.paèNow for the legal? requirements:
Yo⌡á arσá specificall∙á alloweΣ t∩ usσá and/o≥á modif∙á thi≤ ì
prograφ a≤ lonτ a≤ yo⌡ don'⌠ sel∞ i⌠ fo≥ profit«á Pleasσ pas≤ i⌠ ì
alonτá (UN-MODIFIED⌐ t∩ you≥ friends«á Al∞ commercia∞ right≤ fo≥ ì
this program are retained by the author.
If you find this program usefull, please consider the amount of time
and effort which went into this program. A donation of $35 is
required to become a registered user of this program, and intitles
you to the source code, and a phone number for any questions.
Please mail registrations to:
John Lindsay
╡ HighlanΣ St.
Shrewsbury, Ma. 01545
This concludes the document file, I hope you enjoy this
program.
JSL